﻿using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Media;

namespace Main.src.audio
{
    public static class Audio
    {

        private static Song BGM;
        private static Song BGS;

        public static void PlayBGM(string assetName)
        {
            if (BGM != null)
                BGM.Dispose();
            if (assetName == null)
            {
                BGM = null;
                return;
            }
            BGM = Main.self.Content.Load<Song>(assetName);
            MediaPlayer.Play(BGM);
        }

        public static void PlayBGS(string assetName)
        {
            if (BGS != null)
                BGS.Dispose();
            if (assetName == null)
            {
                BGS = null;
                return;
            }
            BGS = Main.self.Content.Load<Song>(assetName);
            MediaPlayer.Play(BGS);
        }

        public static void PlaySE(string assetName, byte volume = 100, sbyte pitch = 0, sbyte pan = 0)
        {
            SoundEffect se = Main.self.Content.Load<SoundEffect>(assetName);
            se.Play(volume / 100.0f, pitch / 100.0f, pan / 100.0f);
        }
    }
}
